package stu.aistar.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import stu.aistar.dao.IMovieDao;
import stu.aistar.model.pojo.Movie;

import java.util.List;

@Controller
@RequestMapping("/details")
public class MovieDetailsController {
    @Autowired
    private IMovieDao iMovieDao;

    @GetMapping("/detail")
    public String test(Model model,String movieid){
        Movie movie = iMovieDao.findMovieById(Integer.valueOf(movieid));
        model.addAttribute("movie",movie);
        return "movie-details";
    }
}
